package com.awa.usercenter.mapper;

import com.awa.usercenter.model.domain.Feedback;
import com.awa.usercenter.model.domain.response.FeedbackResponse;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
* @author zhengcan
* @description 针对表【feedback(用户表)】的数据库操作Mapper
* @createDate 2024-01-23 08:40:42
* @Entity generator.domain.User
*/
@Mapper
public interface FeedbackMapper extends BaseMapper<Feedback> {
    @Select("select count(U.user_id) from user U,feedback FB where U.phone = FB.user_phone and U.create_time BETWEEN DATE_FORMAT(NOW(), '%Y-%m-01') AND LAST_DAY(NOW()) and  FB.event_status = #{status}")
    Long getUserNumByStatus(Long status);

    @Select("SELECT U.*,FB.* FROM  user U,feedback FB where U.phone = FB.user_phone and FB.event_status = #{status}")
    Page<FeedbackResponse> getFeedbackList(Page<FeedbackResponse> pagination, @Param("status") Long status);
}




